home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / share / doc / util-linux / README.Debian.hwclock < prev    next >
Text File  |  2008-09-25  |  3KB  |  66 lines

  1. hwclock and Debian:
  2.  
  3. A Debian installation will, by default, call hwclock --hctosys during system
  4. startup and hwclock --systohc during system shutdown.
  5.  
  6. To set the date/time of the system, just use the standard UNIX date facilities
  7. (such as date) or any of the advanced timekeeping utilities (ntp, ntpdate,
  8. chrony). Other methods of setting the clock (such as hwclock) are likely to 
  9. cause trouble, do not use them.
  10.  
  11. Please note that because the shutdown scripts call hwclock --systohc, you
  12. cannot set the clock using hwclock only, as your adjustment will be lost on
  13. the next reboot. THIS MEANS YOU MUST *NOT* FOLLOW THE PROCEDURES IN THE
  14. hwclock(8) MAN PAGE TO SET THE CLOCK DATE/TIME USING A REBOOT UNLESS YOU
  15. EDIT THE SHUTDOWN SCRIPTS.
  16.  
  17.  
  18. The full story:
  19.  
  20. A Linux system actually has two clocks:
  21.  
  22.  - The System Clock, kept by the kernel. This is the clock that Linux uses for
  23.    day-to-day activities, and this is also the clock you set using date.
  24.  
  25.  - The Hardware Clock, also called RTC, which is used as a backup to keep time 
  26.    while the computer is turned off, or in APM suspended state. This is the
  27.    clock you set using hwclock --set.
  28.  
  29. (you can get more information about these two clocks in the hwclock(8) man
  30. page).
  31.  
  32. hwclock is used to copy time between these two clocks. For the Debian
  33. standard install, the system clock is initialized with the value of the
  34. hardware clock during startup, and the value of the system clock is copied
  35. back to the hardware clock during system shutdown/reboot.
  36.  
  37. So, in a Debian default install, you can keep the illusion that there's a
  38. single clock. Unless you use a program that modifies the hardware clock
  39. directly and does not set the system clock as well, that is.
  40.  
  41.  
  42. Issues with hwclock --adjust:
  43.  
  44. hwclock has a facility to try to correct for systematic drift in the
  45. hardware clock, accessed by hwclock --adjust. This facility is *dangerous*
  46. because it has a severe drawback: it assumes that no program other than
  47. hwclock --systohc will ever be used to change the hardware clock.
  48.  
  49. This assumption is often false, as many common utilities such as ntp,
  50. chrony, as well as your computer's System Setup BIOS program, and
  51. any other OS you have in your machine will change the clock.
  52.  
  53. Also, if hwclock --adjust is used, one must make sure the drift file
  54. (/etc/adjtime) is deleted every time the system clock is set to a very
  55. different value (even if you're using hwclock itself to do it!), or the
  56. drift computation might become invalid and cause the hardware clock to be
  57. incorrectly set the next time hwclock --adjust is used.
  58.  
  59. hwclock currently does not perform any sort of sanity checks in the values
  60. it uses to compute the drift file, and will corrupt your clock time by
  61. potentially very large amounts if anything goes wrong.
  62.  
  63. Don't use the hwclock --adjust facility, refer to alternate (and much safer)
  64. programs such as ntp or chrony if you need precision timekeeping.
  65.  
  66.